package com.jeeplus.test.jlnu.reviewApprove.service.impl;

import com.jeeplus.test.jlnu.reviewApprove.domain.JlnuReviewApprove;
import com.jeeplus.test.jlnu.reviewApprove.mapper.JlnuReviewApproveMapper;
import com.jeeplus.test.jlnu.reviewApprove.service.JlnuReviewApproveService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 审批表(JlnuReviewApprove)表服务实现类
 *
 * @author ChiHongYu
 * @since 2025-02-24 09:12:43
 */
@Service("jlnuReviewApprove")
public class JlnuReviewApproveServiceImpl implements JlnuReviewApproveService {
    @Resource
    private JlnuReviewApproveMapper jlnuReviewApproveMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param approveId 主键
     * @return 实例对象
     */
    @Override
    public JlnuReviewApprove queryById(Integer approveId) {
        return this.jlnuReviewApproveMapper.queryById(approveId);
    }
    
    
    @Override
    public List<JlnuReviewApprove> queryByLimit(Map<String, Object> param, int limit1, int limit2) {
        return this.jlnuReviewApproveMapper.page(param, limit1, limit2);
    }
    
    @Override
    public int queryCount(Map<String, Object> param){
        return this.jlnuReviewApproveMapper.count(param);
    }

    /**
     * 新增数据
     *
     * @param jlnuReviewApprove 实例对象
     * @return 是否成功
     */
    @Override
    public boolean insert(JlnuReviewApprove jlnuReviewApprove) {
        return this.jlnuReviewApproveMapper.insert(jlnuReviewApprove) > 0;
    }

    /**
     * 修改数据
     *
     * @param jlnuReviewApprove 实例对象
     * @return 是否成功
     */
    @Override
    public boolean update(JlnuReviewApprove jlnuReviewApprove) {
        return this.jlnuReviewApproveMapper.update(jlnuReviewApprove) > 0;
    }

    /**
     * 通过主键删除数据
     *
     * @param approveId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer approveId) {
        return this.jlnuReviewApproveMapper.deleteById(approveId) > 0;
    }
    
    /**
     * 通过主键修改使用状态
     *
     * @param approveId 主键
     * @param useState 使用状态
     * @return 是否成功
     */
    @Override
    public boolean changeUseById(Integer approveId, String useState) {
        return this.jlnuReviewApproveMapper.changeUseById(approveId, useState) > 0;
    }
}
